import { v4 as uuidv4 } from 'uuid';
export const haveMarkId = () => {
    if (localStorage.getItem('cancelToken') as string) {
        return
    }
    localStorage.setItem('cancelToken', uuidv4())
}

export const isMarkId = (): { value: string | null } => {
    let isit: boolean = !!localStorage.getItem('cancelToken')
    if (!isit) {
        haveMarkId()
    }
    return {
        value: localStorage.getItem('cancelToken')
    }
}

export const isToken = (): boolean => {
    return localStorage.getItem('token') ? true : false
}


export const getUserName = (): string => {
    if (localStorage.getItem('name')) {
        return localStorage.getItem('name') as string
    } else {
        return ''
    }
}